<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>

<body>
  <div id="box"></div>
  <button id="btn">点击获取数据</button>
</body>
<script>
  $(function () {
    $('#btn').click(fun)
  })
  function fun() {
    new Promise((resolve, reject) => {
      $.get(
        'https://liu.zzgoodqc.cn/promise1 ',
        (res) => {
          if (res.code == 200) {
            $('#box').html('请求1' + res.msg)
            resolve(res.data)
          }
        },
        'json'
      )
    }).then((data) => {
      new Promise((resolve, reject) => {
        $.post(
          'https://liu.zzgoodqc.cn' + data.url,
          (res) => {
            if (res.code == 200) {
              $('#box').append('<p>' + data.name + res.msg + '</p>')
              resolve(res.data)
            }
          },
          'json'
        )
      }).then((data) => {
        new Promise((resolve, reject) => {
          $.get(
            'https://liu.zzgoodqc.cn' + data.url,
            (res) => {
              if (res.code == 200) {
                $('#box').append('<p>' + data.name + res.msg + '</p>')
                resolve(res.data)
              }
            },
            'json'
          )
        }).then((data) => {
          new Promise((resolve, reject) => {
            $.post(
              'https://liu.zzgoodqc.cn' + data.url,
              (res) => {
                if (res.code == 200) {
                  $('#box').append('<p>' + data.name + res.msg + '</p>')
                  $('#box').append('<p>' + res.data.content + '</p>')
                }
              },
              'json'
            )
          })
        })
      })
    })
  }
</script>

</html>